<template>
	<!-- 商城购买 支付页面-此时未生成订单，点击立即支付时生成订单并付款 -->
	<view>
		<view class="card_one">
			<view class="card_content" v-if="preventionFlag == 2">
				<p style="font-size: 32rpx; line-height: 44rpx">
					因疫情防控政策要求，该药品需登记后发货
				</p>
				<p class="gray_font" style="font-size: 28rpx; margin-top: 10rpx">
					平台将保护您的隐私安全，请如实填写以下信息
				</p>
			</view>
			<view class="card_content">
				<view class="peopinfoContent">
					<view v-if="provinces.length > 0">
						<view style="
                                    display: flex;
                                    justify-content: space-between;
                                " @click="addadress">
							<view style="width: 90%">
								<view class="peopinfo">
									<text>{{
                                        provinces[0].name
                                        ? provinces[0].name
                                        : ''
                                    }}</text>
									<text class="phone">{{
                                        provinces[0].phone
                                        ? provinces[0].phone
                                        : ''
                                    }}</text>
								</view>
								<view class="addressinfo">
									<text>
										<!-- 位置信息 -->
										<!-- {{ item.province ? item.province : ''
                                                }}{{ item.city ? item.city : ''
                                                    }} -->
										{{
                                            provinces[0].region
                                            ? provinces[0].region
                                            : ''
                                        }}{{
    provinces[0].address
    ? provinces[0].address
    : ''
}}
									</text>
								</view>
							</view>
							<image style="
                                        width: 40rpx;
                                        height: 30rpx;
                                        float: right;
                                        margin-top: 30rpx;
                                    " src="../../../pagesSub/static/images/icon_right_black.png"></image>
						</view>
					</view>
					<view v-if="provinces.length == 0">
						<view @click="addadress" class="peopinfo" style="display: flex">
							<text>添加地址</text>
							<image style="
                                        width: 40rpx;
                                        height: 30rpx;
                                        margin-top: 10rpx;
                                    " src="../../../pagesSub/static/images/icon_right_black.png"></image>
						</view>
					</view>
				</view>

				<view class="personal_info pa_top personalfont">
					<view><text class="peopinfo">就诊人信息</text></view>
					<view style="display: flex">
						<view style="font-size: 31rpx">
							{{ choosePeopleInfo.name
                                ? choosePeopleInfo.name
                                : ''
                            }}|{{ choosePeopleInfo.sex == 1 ? '男' : choosePeopleInfo.sex == 2 ? '女' : '' }}|{{
    choosePeopleInfo.age ? choosePeopleInfo.age : '' }}岁
						</view>
					</view>
				</view>
			</view>
			<!-- 物流选择 -->
			<view class="card_content" style="width: 84%; display: flex" @click="openPop">
				<!-- @click="openPop" -->
				<text style="color: red">*</text>
				<text class="" style="width: 200rpx"> 配送方式 </text>
				<view style="
                            width: 75%;
                            display: flex;
                            justify-content: space-between;
                        ">
					<text class="" style="width: 80%; text-align: right">
						<!-- 达达 -->
						{{ logisticsName || expressTypeList[0].name }}
					</text>
					<image style="width: 40rpx; height: 30rpx; margin-top: 10rpx"
						src="../../../pagesSub/static/images/icon_right_black.png"></image>
				</view>
			</view>

			<!-- 健康防疫 填写体温 -->
			<!-- <temperature
                            ref="childer"
                            :preventionFlag="preventionFlag"
                            @send="getTemperature"
                            @sendInfo="getpreventionInfo"
                            type="toPayfor"
                            :info="{}"
                            ></temperature> -->
			<view class="card_content" v-if="orderData && orderData.type" style="margin-top: 30rpx">
				<!--      药房-->
				<view class="peopinfoContent" v-if="orderData.type == 5">
					<view style="float: left">
						<image style="
                                    width: 80rpx;
                                    height: 80rpx;
                                    border-radius: 50%;
                                " :src="orderData.storeLogo"></image>
					</view>
					<view class="peopinfo" style="padding-left: 95rpx">
						<text>{{
                            orderData.doctorName ? orderData.doctorName : ''
                        }}</text>
						<text style="padding-left: 15rpx">
							{{ orderData.storeName ? orderData.storeName : '' }}
						</text>
					</view>
					<view class="addressinfo peopinfo" style="padding-left: 95rpx">
						<!-- v-if="orderData.workTime"  -->
						<text style="font-size: 28rpx; color: #d57667">
							营业时间:{{
                                orderData.workTime ? orderData.workTime : ''
                            }}（营业时间内可以配送）
						</text>
					</view>
					<view class="addressinfo peopinfo" style="padding-left: 95rpx">
						<text style="font-size: 28rpx">
							{{
                                orderData.storeAddress
                                ? orderData.storeAddress
                                : ''
                            }}
						</text>
					</view>
				</view>
				<!--      医生-->
				<view class="peopinfoContent" v-else>
					<view style="float: left">
						<image style="
                                    width: 80rpx;
                                    height: 80rpx;
                                    border-radius: 50%;
                                " :src="orderData.doctorImg"></image>
					</view>
					<view class="peopinfo" style="padding-left: 95rpx">
						<text>{{
                            orderData.doctorName ? orderData.doctorName : ''
                        }}</text>
						<text style="padding-left: 15rpx">
							{{
                                orderData.hospitalName
                                ? orderData.hospitalName
                                : ''
                            }}
						</text>
					</view>
					<view class="addressinfo peopinfo" style="padding-left: 95rpx">
						<text style="font-size: 28rpx">
							{{ orderData.jobTitle ? orderData.jobTitle : '' }} |
							{{ orderData.deptName ? orderData.deptName : '' }}
						</text>
					</view>
				</view>
			</view>
			<view class="durgName pad30" style="text-align: right; color: red">
				注：仅带有
				<image class="yibaoTips" src="../../../static/images/chs.png"></image>
				<!-- <text class="yibaoTips">医保</text> -->
				标志的药品支持医保支付
			</view>
			<view class="card_content">
				<view class="content_title medical_title peopinfo">
					<view style="display: flex">
						<image style="width: 45rpx; height: 45rpx"
							src="../../../pagesSub/static/images/icon_h_chu@2x.png"></image>
						<view><text class="peopinfo">订单信息</text></view>
					</view>
				</view>
				<view>
					<view class="medical_content" v-for="(data, index) in drugcontent" :key="index">
						<view class="medical_img">
							<image :src="data.img"></image>
						</view>
						<view class="medical_right">
							<view class="medical_title">
								<view>
									<view class="medicalName">
										<view class="durgName">
											<image class="yibaoTips" v-if="(data.medicalItemCode ||
                                                data.medicalItemCode2) &&
                                                data.medicalFlag == 1
                                                " src="../../../static/images/chs.png"></image>
											<!-- <text
                                                        class="yibaoTips"
                                                        v-if="data.medicalItemCode"
                                                        >医保</text
                                                        > -->
											{{ data.name }}
										</view>
									</view>

									<view class="specification gray_font">
										规格：{{
                                            data.specification
                                            ? data.specification
                                            : '暂无规格'
                                        }}
									</view>
								</view>

								<view class="medicalName">x{{ data.count }}</view>
							</view>
							<view class="medical_price">￥{{ data.price }}</view>
						</view>
					</view>
				</view>
			</view>
			<!-- 发票 -->
			<view class="card_content">
				<view class="personal_info">
					<text class="specification gray_font">开具发票</text>
					<view class="specification" style="display: flex" @click="toggle('bottom')">
						<view v-if="invoiceval.isBill == 1">
							<text style="font-size: 31rpx">本次不开具发票</text>
						</view>
						<view v-if="invoiceval.isBill == 0 &&
                            invoiceval.billType == 1
                            ">
							<text style="font-size: 31rpx">普通发票-个人</text>
						</view>
						<view v-if="invoiceval.isBill == 0 &&
                            invoiceval.billType == 2
                            ">
							<text style="font-size: 31rpx">普通发票-公司</text>
						</view>
						<image style="
                                    width: 40rpx;
                                    height: 30rpx;
                                    margin-top: 8rpx;
                                " src="../../../pagesSub/static/images/icon_right_black.png"></image>
					</view>
				</view>
				<view v-if="invoiceval.isBill == 0 && invoiceval.billType == 1">
					<view class="specification">发票抬头：{{ invoiceval.rise }}</view>
				</view>
				<view v-if="invoiceval.isBill == 0 && invoiceval.billType == 2">
					<view class="specification">发票抬头：{{ invoiceval.unitName }}</view>
					<view class="specification">
						纳税人识别号：{{ invoiceval.taxPayerNo }}
					</view>
				</view>
			</view>
			<view>
				<view style="margin-left: 60rpx">选择支付方式</view>
				<view class="card_content">
					<!-- v-if=" orderData.weiFlag != 1 || orderData.isMedicalSupport != 1" -->
					<!--  //是否是东营的药店  0-是东营 1：不是 -->
					<!-- isMedicalSupport 是否支持医保支付(0是1否)  weiFlag 是否支持微信支付(0是1否) -->
					<radio-group class="radio-wrap" @change="hosChange">
						<!-- 只有东营的显示医保预约 -->
						<label for="" v-if="orderData.isDongyingStore == 1">
							<!-- <view v-if="orderData.isMedicalSupport == 1">
									<view class="personal_info" style="
                                    padding: 20rpx 0;
                                    border-bottom: 1px solid #fbf5f5;
                                    margin-bottom:10rpx;
                                ">
										<view style="display: flex">
											<image style="width: 60rpx; height: 44rpx" src="../../../static/images/chs.png">
											</image>
											<view>
												<text class="specification" style="margin-left: 20rpx">
													医保预约
												</text>
											</view>
										</view>
										<radio value="yuyue" :checked="wxPay == 'yuyue'" color="#4ccdbc"
											style="transform: scale(1)" />
									</view>
								</view> -->
							<view v-if="orderData.weiFlag == 0" class="personal_info" style="
                                        padding-bottom: 20rpx;
                                        border-bottom: 1px solid #fbf5f5;
                                    ">
								<view style="display: flex">
									<image style="width: 60rpx; height: 48rpx"
										src="../../../pagesSub/static/images/wxpay.png"></image>
									<view>
										<text class="specification" style="margin-left: 20rpx">
											微信支付<text style="font-size: 24rpx" v-if="isShowCoupon.includes('0')
                                                ">{{ couponPayType.fullkey }}</text>
										</text>
									</view>
								</view>
								<radio value="0" :checked="wxPay == '0'" color="#4ccdbc" style="transform: scale(1)" />
							</view>
							<view v-if="orderData.isMedicalSupport == 0">
								<view class="personal_info" style="
                                            padding: 20rpx 0;
                                            border-bottom: 1px solid #fbf5f5;
                                        ">
									<view style="display: flex">
										<image style="width: 60rpx; height: 44rpx" src="../../../static/images/chs.png">
										</image>
										<view>
											<text class="specification" style="margin-left: 20rpx">
												医保支付<text style="font-size: 24rpx" v-if="isShowCoupon.includes('1')
                                                    ">{{ couponPayType.fullkey }}</text>
											</text>
										</view>
									</view>
									<radio value="1" :checked="wxPay == '1'" color="#4ccdbc"
										style="transform: scale(1)" />
								</view>
							</view>

						</label>

						<view v-if="orderData.isDongyingStore == 0">
							<!--  //是否是东营的药店  0-是东营 1：不是 -->
							<!-- 是东营药店 -->
							<view>
								<view class="personal_info" style="
                                    padding: 20rpx 0;
                                    border-bottom: 1px solid #fbf5f5;
                                    margin-bottom:10rpx;
                                ">
									<view style="display: flex">
										<image style="width: 60rpx; height: 44rpx" src="../../../static/images/chs.png">
										</image>
										<view>
											<text class="specification" style="margin-left: 20rpx">
												医保预约
											</text>
										</view>
									</view>
									<radio value="yuyue" :checked="wxPay == 'yuyue'" color="#4ccdbc"
										style="transform: scale(1)" />
								</view>
							</view>
							<view class="personal_info" style="
                                        padding-bottom: 20rpx;
                                        border-bottom: 1px solid #fbf5f5;
                                    ">
								<view style="display: flex">
									<image style="width: 60rpx; height: 56rpx"
										src="../../../pagesSub/static/images/zhPay.png"></image>
									<view>
										<text class="specification" style="margin-left: 20rpx">
											农行支付<text style="font-size: 24rpx" v-if="isShowCoupon.includes('nonghang')
                                                ">{{ couponPayType.fullkey }}</text>
										</text>
									</view>
								</view>
								<radio value="nonghang" :checked="wxPay == 'nonghang'" color="#4ccdbc"
									style="transform: scale(1)" />
							</view>
							<view v-if="orderData.isMedicalSupport == 0">
								<!-- 东营的市aok不为空且不为''时显示东营医保 -->
								<view v-if="orderData.cityAok != null && orderData.cityAok.length != 0"
									class="personal_info" style="
                                        padding: 20rpx 0;
                                        border-bottom: 1px solid #fbf5f5;
                                    ">
									<view style="display: flex">
										<image style="width: 60rpx; height: 60rpx"
											src="../../../pagesSub/static/images/dyyb1.png"></image>
										<view>
											<text class="specification" style="margin-left: 20rpx">
												东营医保<text v-if="isShowCoupon.includes(
    											    '市医保'
    											)
    											    " style="font-size: 24rpx">{{ couponPayType.fullkey }}</text>
											</text>
										</view>
									</view>
									<radio value="市医保" :checked="wxPay == '市医保'" color="#4ccdbc"
										style="transform: scale(1)" />
								</view>
								<!-- 东营的省aok不为空且不为''时显示油田医保 -->
								<view v-if="orderData.provinceAok != null && orderData.provinceAok.length != 0"
									class="personal_info" style="padding: 20rpx 0;border-bottom: 1px solid #fbf5f5;
                                    ">
									<view style="display: flex">
										<image style="width: 60rpx; height: 56rpx"
											src="../../../pagesSub/static/images/oil1.png"></image>
										<view>
											<text class="specification" style="margin-left: 20rpx">
												油田医保<text v-if="isShowCoupon.includes('省医保')
    											    " style="font-size: 24rpx">{{ couponPayType.fullkey }}</text>
											</text>
										</view>
									</view>
									<radio value="省医保" :checked="wxPay == '省医保'" color="#4ccdbc"
										style="transform: scale(1)" />
								</view>
							</view>

							<view v-if="orderData.weiFlag==0" class="personal_info" style="
                                        padding: 20rpx 0;
                                        border-bottom: 1px solid #fbf5f5;
                                    ">
								<view style="display: flex">
									<image style="width: 60rpx; height: 48rpx"
										src="../../../pagesSub/static/images/wxpay.png"></image>
									<view>
										<text class="specification" style="margin-left: 20rpx">
											微信支付<text v-if="isShowCoupon.includes('0')
                                                " style="font-size: 24rpx">{{
        couponPayType.fullkey
    }}</text>
										</text>
									</view>
								</view>
								<radio value="0" :checked="wxPay == '0'" color="#4ccdbc" style="transform: scale(1)" />
							</view>
						</view>
					</radio-group>
				</view>
			</view>
			<!-- 优惠券 -->
		<!-- 	<view v-if="activeList.length > 0" >
				<view v-for="(activeInfo, index) in activeList" :key="index">
					<checkbox-group class="radio-wrap" @change="useCouponChange">
						<label for="" class="servicecard couponCard" style="display: flex;justify-content: space-between;
                                ">
							<view>
								<span class="couponType">{{
                                    activeType[activeInfo.activityType] ||
                                    '平台券'
                                }}</span>
								<div class="disFlex">
									<span>
										<span class="danwei">￥</span>
										<span class="money">{{
                                            activeInfo.useMoney || 0
                                        }}</span>
									</span>
									<span class="manjian">
										满{{ activeInfo.freeMoney }}减{{
                                            activeInfo.useMoney
                                        }}
									</span>
								</div>
								<view class="haveCount" hover-class="none" hover-stop-propagation="false">
									有效期：
								</view>
								<view class="haveCount" hover-class="none" hover-stop-propagation="false">
									{{ activeInfo.startTime }}-{{
                                        activeInfo.endTime
                                    }}
								</view>

								 
							</view>
				 

							<div style="display:flex;flex-direction: column;">

								<checkbox :disabled="activeInfo.flag == 2" :value="activeInfo.id"
									:checked="selectId == activeInfo.id" color="#4ccdbc"
									style="transform: scale(1); margin: 30rpx 0 0 30rpx" />
								 
							</div>
						 
						</label>

					</checkbox-group>
				</view>
			 
			</view> -->

			<view class="card_content">
				<view class="personal_info">
					<text class="specification gray_font">商品总金额</text>
					<text class="medicalName">￥{{ sum }}</text>
				</view>
				<view class="personal_info">
					<text class="specification gray_font">配送费</text>
					<text class="medicalName">
						￥{{ distributionFees ? distributionFees : 0 }}
					</text>
				</view>
				<view class="personal_info">
					<text class="specification gray_font">实付款</text>
					<text class="real_payment medicalName">￥{{ allPrice.toFixed(2) }}</text>
				</view>
				<view class="personal_info" v-if="orderValue == 1">
					<text class="specification gray_font">医保余额</text>
					<text class="medicalName">￥{{ yibaoInfo.ye || '0' }}</text>
				</view>
			</view>
			<view class="customerService">
				<image @click="Service" src="../../../pagesSub/static/images/btn_h_ke@2x.png"></image>
			</view>
			<view class="payment_button" v-if="orderData.weiFlag == 0 || orderData.isMedicalSupport == 0">
				<view class="combined">
					合计:
					<text class="combined_money">￥{{ allPrice.toFixed(2) }}</text>
				</view>
				<button :disabled="extraction" class="immediate" @click="getOrderPay">
					立即支付
				</button>
			</view>

			<!-- 展码二维码 -->
			<!-- <uni-popup ref="openPopup" background-color="#fff" :mask-click="false">
                <view class="popup-content">
                    <yz-qr ref="qrPath" 
                    :text="abcde"
                    :size="size" :colorDark="colorDark" 
                    :colorLight="colorLight"
                     @closeOpen="closeOpen">
                </yz-qr>
                </view>
                <view class="openPopImg" hover-class="none" hover-stop-propagation="false">
                     <image src="../../static/closeBtn.png"> </image>
                </view>
               
            </uni-popup> -->
			<!-- 立即支付确认框  不退不换 -->
			<uni-popup ref="notChangePop" type="dialog">
				<view class="inputDialog">
					<view class="title">
						由于药品属于特殊商品，一经售出，概不退换
					</view>

					<view class="button-bottom">
						<view class="cancel" @click="closeTem">取消</view>
						<view @click="toOrderPay()" class="green_words">确定</view>
					</view>
				</view>
			</uni-popup>
			<!-- 医保预约提示框   -->
			<uni-popup ref="callPop" type="dialog">
				<view class="inputDialog">
					<view class="title">
						请拨打药店电话，预约送药上门，医保支付。
					</view>

					<view class="button-bottom">
						<view class="cancel" @click="closeCall">取消</view>
						<view @click="call()" class="green_words">拨打</view>
					</view>
				</view>
			</uni-popup>
			<!-- 物流弹窗 -->
			<uni-popup ref="logisticsPopup" type="center">
				<view class="dialogDiangnosis" v-show="expressTypeList.length >= 0">
					<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y" @scroll="scroll">
						<radio-group class="block" @change="changeCheckbox">
							<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in expressTypeList"
								:key="index">
								<uni-list-item :title="item.name" :border="false">
									<template v-slot:footer>
										<radio :value="String(item.type)" color="#4ccdbc" :checked="index == current" />
									</template>
								</uni-list-item>
							</label>
						</radio-group>
					</scroll-view>

					<view class="btn_style">
						<button class="arc_button width"
							style="background: -webkit-linear-gradient(#77e2a4,#4ccdbc) !important;width: 200rpx;line-height: 60rpx;height: 60rpx;border-radius: 30rpx;"
							type="primary" @click="saveDiagnosis">
							确定
						</button>
					</view>
				</view>
			</uni-popup>
			<view>
				<!-- 发票弹窗 -->
				<uni-popup ref="popup" background-color="#fff" :mask-click="false">
					<view style="padding: 30rpx">
						<view class="colse_content">
							<image @click="closeinvoice" style="
                                        width: 50rpx;
                                        height: 50rpx;
                                        float: right;
                                    " src="../../../pagesSub/static/images/icon_close_gray.png"></image>
						</view>
						<view class="personal_info">
							<text class="specification">发票类型</text>
							<text class="specification gray_font">普通发票</text>
						</view>
						<view class="personal_info">
							<text class="specification">开具发票</text>
							<view>
								<switch :checked="isChecked" color="#4CCCBF" style="
                                            margin-top: -8rpx;
                                            transform: scale(0.7);
                                        " @change="changeInvoice" />
							</view>
						</view>
						<view v-if="invoiceval.isBill == 0">
							<text class="specification">发票抬头</text>
							<view class="invoice">
								<view style="margin-right: 15rpx" :class="checkstatus == 1 ? 'tag' : ''"
									@click="invoiceType(1)" class="bth_green">
									个人
								</view>
								<view :class="checkstatus == 2 ? 'tag' : ''" @click="invoiceType(2)" class="bth_green">
									公司
								</view>
							</view>
							<view class="invoiceInput" v-if="checkstatus == 1">
								<view style="display: flex">
									<view style="
                                                color: #ff5100;
                                                font-size: 40rpx;
                                                margin-right: 5rpx;
                                            ">
										*
									</view>
									<uni-easyinput style="width: 100%" v-model="invoiceval.rise"
										placeholder="请填写开具发票人的姓名">
									</uni-easyinput>
								</view>
							</view>
							<view class="invoiceInput" v-if="checkstatus == 2">
								<view>
									<view style="display: flex">
										<view style="
                                                    color: #ff5100;
                                                    font-size: 40rpx;
                                                    margin-right: 5rpx;
                                                ">
											*
										</view>
										<uni-easyinput style="width: 100%" v-model="invoiceval.unitName"
											placeholder="请填写单位名称"></uni-easyinput>
									</view>
								</view>
								<view style="margin-top: 20rpx">
									<view style="display: flex">
										<view style="
                                                    color: #ff5100;
                                                    font-size: 40rpx;
                                                    margin-right: 5rpx;
                                                ">
											*
										</view>
										<uni-easyinput type="number" style="width: 100%" v-model="invoiceval.taxPayerNo"
											placeholder="请填写纳税人识别号"></uni-easyinput>
									</view>
								</view>
							</view>
						</view>
						<button @click="saveinvoiced" class="btn_invoice" type="default">
							确定
						</button>
					</view>
				</uni-popup>
			</view>

			<!-- <couponPop ref="couponChild" :couponPopTips='couponPopTips'
                            ></couponPop> -->
			<uni-popup ref="couponPop">
				<view class="inputDialog">
					<view class="title">
						{{ couponPopTips }}
					</view>
					<view class="button-bottom">
						<view class="cancel" @click="closeCoupon">取消</view>
						<view @click="closeCoupon" class="green_words">确定</view>
					</view>
				</view>
			</uni-popup>
		</view>
	</view>
</template>


<script>
	var app = getApp();


	import {
		fiveOrderInfo, //根据580订单号获取就诊人信息以及购买药品信息
	} from '@/pagesSub-Five/api/index.js';
	import {
		pharmacy,
		addressList
	} from '@/api/prescribing.js';
	import store from '@/store';
	import {
		openOrderPaySubscribe
	} from '@/utils/SubscribeMessage.js';
	import {
		medicalOrder,
		getFreight,
		preventionFlag
	} from '@/api/order.js';
	import {
		wechatOrderPay,
		yibaoOrderPay,
		yibaoMoney,
		nonghangOrderPay,
		getCouponPayType,
	} from '@/api/consult.js';
	import {
		userInfo,
		getUserCoupon,
		getUserCouponFlag
	} from '@/api/user.js';
	import temperature from 'pagesSub/components/temperature/temperature.vue';
	import couponPop from 'pagesSub/components/couponPop/index.vue';
	export default {
		components: {
			temperature,
			couponPop,
		},
		data() {
			return {
				bankUrl: 'https://mobile.abchina.com/mpay/mobileBank/zh_CN/EBusinessModule/BarcodeH5Act.aspx?token=16660922793005524094', //农行支付跳转链接
				couponPopTips: '', //'使用本券请选择中国农业银行支付111', //优惠券提示文案---配置后需后端返回
				couponPayType: {}, //满减提示及标识
				isShowCoupon: [], //开放满减券标识  '市医保','nonghang'
				couponDisabled: true, //是否可以选中优惠券
				selectId: 0, ////选择的优惠券id
				selectCoupon: '0', //优惠券金额
				activeList: [
					// {id:1,},{id:2},{id:3},{id:4,},{id:5},{id:6}
				], //优惠券列表
				activeType: {
					0: '平台券',
					1: '商家券',
				},
				// 支付方式优惠字典项
				payType: {
					nonghang: '中国农业银行',
					0: '微信支付',
					1: '医保支付',
					省医保: '油田医保',
					市医保: '东营医保',
				},
				// isDongying: '1',
				// expressIndex: 0, //快递列表的下标
				expressTypeList: [{
						name: '达达',
						type: '1',
					},
					{
						name: '到店自提',
						type: '2',
					},
					{
						name: '快递',
						type: '3',
					},
				], // 快递类型列表
				logisticsName: '', //所选快递
				logisticsType: '1', // 快递类型  1:达达 2：自提
				current: 0, // 快递
				yibaoInfo: '', //医保信息
				temperature: '', //体温
				orderValue: 0, //支付方式  微信支付、医保支付
				wxPay: '', // 选中的支付方式 0：微信 1：医保 nonghang：农行 '省医保'：油田医保 '市医保'：东营医保
				offline: '',
				extraction: false,
				drugcontent: [],
				info: [],
				choosePeopleInfo: {},
				adderss: {},
				provinces: [],
				diagnosisLists: [],
				entrusts: '',
				sum: 0, //商品总金额
				allPrice: 0, // 合计、实付款
				type: '',
				checkstatus: 1,
				isChecked: false, //开具发票是否选中
				invoiceval: {
					isBill: 1,
					billType: 1,
					rise: '',
					unitName: '',
					taxPayerNo: '',
				},
				distributionFees: '', //运费
				orderData: {},
				cityCode: '',
				shopNo: '',
				// preventionInfo: {
				//     //防疫信息
				//     foreginFlag: '1', //是否出境
				//     coolFlag: '1', //是否冷链高危人员
				//     foreginTouch: '1', //是否接触境外人员
				//     symptom: '发热', //选中的症状
				//     otherStr: '', //其他
				//     choceFlag: false, // 承诺选中
				// },
				medicalIdList: [], // 药品id列表
				preventionFlag: 1, //是否需要填写防疫信息
				buttonRect: {},
				bizOrderId: '', //580订单编号id
			};
		},
		onShow: function() {

		 
			
			
			
			// if (this.logisticsType == 1) {
			// logisticsType ==1 ：达达快递，需要查询运费
			this.addressLists(); // 查询地址后查询运费 // 回到页面要请求下快递运费的接口，因为地址有可能重新改变
			// }
			// 立即支付按钮置灰跳转到导航栏：我的
			if (this.extraction) {
				this.$util.Tips({
					endtime: 500,
					// title: '支付成功',
					// icon: 'success',
				}, {
					tab: 1,
					url: '/pages/my/index',
				});
			}
			// 查询药品是否需要登记
			// this.getPreventionFlag();
			//价格
			this.medicalPrice();
			//医生信息
			this.getUserInfo();
			//查询优惠券
			// this.useCoupon();
		},
		onLoad: function(option) {
			// setInterval(function(){
			//     this.time_num= this.time_num++
			//     this.abcde="adasdasdasdas"+ this.time_num
			//     console.log(this.abcde ,"要改变二维码了----", this.time_num)
			// },5000)
			
			
			//添加药店是否显示第三种送达方式
			if (store.state.app.flag) {
				//0不支持 1支持
			 
				if (store.state.app.flag === '1') {
					this.logisticsType = 3;
					this.expressTypeList = this.expressTypeList.slice(2, 3);
				} else {
			
					this.expressTypeList = this.expressTypeList.slice(0, 2);
				}
			
			} else {
			
				this.expressTypeList = this.expressTypeList.slice(0, 2);
			}
			if (option.item) {
				let item = JSON.parse(decodeURIComponent(option.item));
				this.choosePeopleInfo = item;
			}
			if (option.medicals) {
				let medical = JSON.parse(decodeURIComponent(option.medicals));
				this.drugcontent = medical;
				this.drugcontent &&
					this.drugcontent.map((item) =>
						this.medicalIdList.push(item.id)
					);
			}
			if (option.bizOrderId) {
				// console.log(option.bizOrderId, '580数据')
				// 580订单号
				this.bizOrderId = option.bizOrderId;
				// 580聊天页面跳转过来，根据580订单号获取就诊人信息以及购买药品信息
				this.getOrderInfo()
			}
			
		},

		methods: {
			// 580聊天页面跳转过来请求就诊人信息以及药品信息
			getOrderInfo() {
				uni.showLoading({
					title: '加载中'
				})
				fiveOrderInfo(this.bizOrderId)
					.then((res) => {
						uni.hideLoading();
						//由于580问诊医生开方或医生拒诊，跳转的都是待支付页面，
						// 所以后端做出拦截，通过接口返回flag字段(1=开方，2=拒诊)，reason=拒诊原因
						// 前端用flag字段判断580医生是否拒诊，跳转不同页面(医生拒诊显示弹窗跳转tab药房页面)
						// flag: 1可以购买 2=不能购买
						if (res.data.flag == 2) {
							uni.showModal({
								title: '温馨提示',
								content: res.data.reason,
								showCancel: false,
								success(rt) {
									if (rt.confirm) {
										// 医生拒诊后，跳转到药房列表页
										uni.switchTab({
											url: '/pages/homePage/shopList'
										});
									}
								}
							})
						}
						// 药品信息
						this.drugcontent = res.data.productList;
						// 就诊人信息
						this.choosePeopleInfo = res.data.appPatientResponseBody;
						// 商品总金额
						this.medicalPrice();
					})
					.catch((err) => {
						uni.hideLoading();
						uni.showToast({
							title: err,
							icon: 'none',
							duration: 3000,
						});
					});
			},
			// 关闭展码二维码
			closeOpen() {
				this.$refs.openPopup.close()
			},
			// 打开展码
			toOpen(item) {
				this.selectId = 0 //取消选中的优惠券
				this.saveCouponPopup();
				this.abcde = HTTP_REQUEST_URL + `scan?id=${item.id}&useMoney=${item.useMoney}`
				// 'https://syapi.sdhryl.cn/scan?id=3627b825b5b047be99564cbcdd1a0d6c&useMoney=30'//+
				setTimeout(() => {
					this.$refs.openPopup.open()
				}, 1000)
				// console.log(this.abcde + "这个是二维码地址33333")

			},
			// 查询满减券支付方式
			getCouponPaytype() {
				// let storeId = store.state.app.storeId; //药店id
				let activeId = this.activeList[0].id;
				getCouponPayType(activeId)
					.then((res) => {
						if (res.code == 200) {
							this.couponPayType = res.data;
							this.isShowCoupon = res.data.typeList; // true;
							// console.log(this.isShowCoupon, '9999-----优惠券支付方式');
						}
					})
					.catch((err) => {
						uni.showToast({
							title: err,
							icon: 'none',
							duration: 3000,
						});
					});
				// this.isShowCoupon = ['nonghang','市医保','省医保']

				//// 1农行支付2东营医保3油田医保4微信支付5医保支付
				// 前端映射一下
				// let typeMap = {
				//     1:'nonghang',
				//     2:'市医保',
				//     3:'省医保',
				//     4:'0', //微信支付
				//     5:'1' //医保支付
				// }
				// // 接口取的type
				// let type = [1,2,3] //res.data // [1,2]
				// type.map(item=> this.isShowCoupon.push(typeMap[item]) )
			},
			//使用优惠券
			useCoupon() {
				// this.$refs.couponPopup.open('bottom');
				// 查询是否可用优惠券
				let allPrice = this.$util.$h.Add(this.sum, 0);
				let storeId = store.state.app.storeId; //药店id
				getUserCouponFlag(storeId, '')
					.then((res) => {
						if (res.code == 200) {
							this.activeList = res.data; // true;
							if (res.data.length > 0) {
								// 查询满减券支付方式
								this.getCouponPaytype();
								this.activeList.map((item) => {
									if (allPrice >= item.freeMoney && item.flag == 1) {
										item.flag = 1; //1 能用 2：不能用
										this.couponDisabled = false;
									} else {
										item.flag = 2;
										this.couponDisabled = true;
									}
								});
							}
						}
					})
					.catch((err) => {
						uni.showToast({
							title: err,
							icon: 'none',
							duration: 3000,
						});
					});
			},
			// 获取是否需要填写防疫信息的标识
			getPreventionFlag() {
				preventionFlag(this.medicalIdList)
					.then((res) => {
						if (res.code == 200) {
							this.preventionFlag = res.data.preventionFlag;
						} else {
							this.$util.Tips({
								title: res.msg,
								icon: 'none',
								duration: 3000,
							});
						}
					})
					.catch((err) => {
						this.$util.Tips({
							title: err,
							icon: 'none',
							duration: 3000,
						});
					});
			},
			openPop() {
				this.$refs.logisticsPopup.open();
			},
			// 确定选中的物流
			saveDiagnosis() {
				debugger
				this.logisticsName = this.expressTypeList[this.current].name; //物流名称
				this.logisticsType = this.expressTypeList[this.current].type; // 物流类型
				this.$refs.logisticsPopup.close();

				if (this.logisticsType == 1) {
					// 达达快递
					this.addressLists();
				} else {
					// 自提
					this.distributionFees = 0;
					this.allPrice = this.$util.$h.Add(
						this.distributionFees,
						this.sum
					);
				}

				this.saveCouponPopup(); //重新计算金额
			},
			// 选择物流
			changeCheckbox(e) {
				for (let i = 0; i < this.expressTypeList.length; i++) {
					if (this.expressTypeList[i].type == e.detail.value) {
						this.current = i; //选中的物流下标
						break;
					}
				}
			},

			// getTemperature(value) {
			//     this.temperature = value;
			// },
			// getpreventionInfo(info) {
			//     this.preventionInfo = info; //{}
			// },
			// 医保预约拨打电话
			call() {
				let listPhone = [],
					that = this;

				this.orderData.listPhone.map(item => {
					listPhone.push(item)
				})
				listPhone.push(this.orderData.doctorPhone) //店长手机
				uni.showActionSheet({
					title: '联系电话',
					itemList: listPhone, // this.listPhone, // '12345676543',
					popover: {
						top: that.buttonRect.top * 2 + that.buttonRect.height,
						left: that.buttonRect.left + that.buttonRect.width / 2
					},
					success: e => {
						// console.log(e, 'e的数据');
						uni.makePhoneCall({
							phoneNumber: listPhone[e.tapIndex], // this.listPhone,
							success: () => {
								// console.log('拨打电话');
							}
						});
					}
				});
				// uni.makePhoneCall({
				//     phoneNumber: phone || '19999999' , // this.listPhone[e.tapIndex],
				//     success: () => {
				//         console.log('拨打电话');
				//     }
				// });
			},
			//取消医保预约电话弹框
			closeCall() {
				this.$refs.callPop.close();
			},
			//取消支付弹框
			closeTem() {
				this.$refs.notChangePop.close();
			},
			// 关闭优惠券提示文案对话框
			closeCoupon() {
				this.selectId = '';
				this.$refs.couponPop.close();
			},
			hosChange(val) {
				// 0-微信支付 1：医保支付 "省医保"： 油田支付  "市医保" ：东营医保  "yuyue":预约医保
				this.orderValue = val.target.value;
				this.wxPay = val.target.value;
				let allPrice = this.$util.$h.Add(this.sum, 0);

				let storeId = store.state.app.storeId; // this.orderData.pharmacyId;  //药店id

				// 如果是东营药店&& this.orderData.isDongyingStore == '1' 不需要查询医保余额
				// 返回的支付方式和选中的相同的话 就选中 否则不选中
				if (this.isShowCoupon.includes(this.orderValue)) {
					this.selectedCoupon();
				} else {
					// 不选中优惠券
					this.selectId = '0';
				}
				if (this.orderValue == 1) {
					// 查询医保余额
					yibaoMoney(storeId)
						.then((res) => {
							this.yibaoInfo = res.data;
							// 判断余额够不够 不够的话不让医保支付
							if (this.yibaoInfo.ye < this.sum) {
								return uni.showToast({
									title: '医保余额不足，请更换支付方式',
									icon: 'none',
									duration: 3000,
								});
							}
						})
						.catch((err) => {
							uni.showToast({
								title: err,
								icon: 'none',
								duration: 3000,
							});
						});
				}

				// 非医保预约的获取优惠券
				if (this.wxPay != 'yuyue') {
					this.saveCouponPopup();
				}

			},
			// 选中优惠券
			selectedCoupon() {
				let allPrice = this.$util.$h.Add(this.sum, 0);
				this.activeList.map((item) => {
					if (allPrice >= item.freeMoney && item.flag == 1) {
						item.flag = 1; //1 能用 2：不能用
						this.selectId = this.activeList[0].id;
					} else {
						item.flag = 2;
					}
				});
			},
			getUserInfo() {
				let serviceUidCache = store.state.app.serviceUid || 0;
				// console.log(serviceUidCache);
				userInfo(serviceUidCache)
					.then((res) => {
						this.orderData = res.data; //药店信息 包含是否微信支付
					})
					.catch((err) => {
						console.log(err, err);
					});
			},
			// 选择某个优惠券
			useCouponChange(val) {
				// 返回的可用优惠券的支付方式不包含选中的 将selectId=0 不选中优惠券
				if (!this.isShowCoupon.includes(this.orderValue)) {
					this.selectId = 0;
					this.couponPopTips = this.couponPayType.frameKey;
					this.$refs.couponPop.open();
				} else {
					this.selectId = val.target.value[0] || 0;
				}
				this.saveCouponPopup();
			},
			//确定优惠券
			saveCouponPopup() {
				if (this.selectId != 0) {
					this.activeList.map((item) => {
						if (item.id == this.selectId) {
							// console.log(this.selectCoupon, item.useMoney,'----kkkkk ')
							this.selectCoupon = item.useMoney;
						}
					});
				} else {
					// 不使用优惠券
					this.selectCoupon = 0;
				}
				// 商品总金额-优惠金额+配送费
				this.allPrice = this.$util.$h.Add(
					this.$util.$h.Sub(this.sum, this.selectCoupon),
					this.distributionFees
				);
			},
			closeinvoice() {
				let _this = this;
				this.invoiceval.isBill = 1;
				this.isChecked = false;
				this.invoiceval.rise = '';
				this.invoiceval.unitName = '';
				this.invoiceval.taxPayerNo = '';
				this.checkstatus = 1;

				this.$refs.popup.close();
			},
			//保存发票
			saveinvoiced() {
				let _this = this;
				if (
					_this.invoiceval.isBill == 0 &&
					_this.invoiceval.billType == 1
				) {
					if (_this.invoiceval.rise == '') {
						uni.showToast({
							title: '请填写发票抬头',
							icon: 'none',
							duration: 3000,
						});
						return;
					}
				}
				if (
					_this.invoiceval.isBill == 0 &&
					_this.invoiceval.billType == 2
				) {
					if (
						_this.invoiceval.unitName == '' ||
						_this.invoiceval.taxPayerNo == ''
					) {
						uni.showToast({
							title: '请填写发票信息',
							icon: 'none',
							duration: 3000,
						});
						return;
					}
				}

				this.$refs.popup.close();
			},
			// 开具发票按钮
			changeInvoice(e) {
				this.isChecked = e.target.value;
				if (e.target.value) {
					this.invoiceval.isBill = 0;
				} else {
					this.invoiceval.isBill = 1;
				}
			},
			invoiceType(type) {
				this.checkstatus = type;
				this.invoiceval.billType = type;
				if ((type = 2)) {
					this.invoiceval.rise = '';
				}
				if ((type = 1)) {
					this.invoiceval.unitName = '';
					this.invoiceval.taxPayerNo = '';
				}
			},
			toggle(type) {
				this.type = type;
				// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
				this.$refs.popup.open(type);
			},
			Service() {
				uni.navigateTo({
					url: `/pagesSub-My/my/customerService`,
				});
			},
			// 添加和选取地址方法
			addadress() {
				uni.navigateTo({
					url: `/pagesSub-My/my/addressList`,
				});
			},
			//药品价格
			medicalPrice() {
				let _this = this;
				//药品价格
				let sum = 0;
				_this.drugcontent.forEach((item) => {
					sum += item.price * item.count;
				});
				_this.sum = sum.toFixed(2); //商品总金额
				//查询优惠券
				this.useCoupon();
				// console.log("商品总金额---", _this.sum)
			},

			addressLists() {
				addressList()
					.then((res) => {
						console.log("^^^^地址", JSON.stringify(res))
						this.provinces = res.rows.filter(
							(item) => item.defaultFlag == '0'
						);
						// 重新修改地址
						let pages = getCurrentPages(); //获取所有页面栈实例列表
						let nowPage = pages[pages.length - 1]; //当前页页面实例
						// let prevPage = pages[ pages.length - 2 ];  //上一页页面实例
						// prevPage.address= item;   //修改上一页data里面的name参数值为1211
						// console.log(nowPage,'重新选的地址')
						if (nowPage.address) {
							this.provinces = [];
							this.provinces.push(nowPage.address);
						}
						// 查询运费
						// console.log(this.provinces, this.logisticsType, '666===')
						
						
						if (this.provinces.length > 0 && this.logisticsType == 1) {
							var obj = {
								longitude: this.provinces[0].longitude,
								latitude: this.provinces[0].latitude,
								recieveName: this.provinces[0].name,
								recievePhone: this.provinces[0].phone,
								recieveAddress: this.provinces[0].region,
								storeId: store.state.app.storeId, //药店id
							};
							debugger
							// console.log(obj, '入参999---');
							getFreight(obj)
								.then((res) => {
									// console.log(res, 'res运费结果');
									if (res.code == 200) {
										this.distributionFees =
											res.data.deliveryFee;


										this.cityCode = res.data.cityCode;
										this.shopNo = res.data.shopNo;
										this.allPrice = this.$util.$h.Add(
											this.distributionFees,
											this.sum
										);
										// console.log(this.allPrice, '777===')
										this.saveCouponPopup(); //切换物流后重新计算金额
									} else {
										this.$util.Tips({
											title: res.msg,
											icon: 'none',
											duration: 3000,
										});
									}
								})
								.catch((err) => {
									this.$util.Tips({
										title: err,
										icon: 'none',
										duration: 3000,
									});
								});
						} else {
							this.distributionFees = 0; //
							this.cityCode = '';
							this.shopNo = '';
							this.allPrice = this.$util.$h.Add(
								this.distributionFees,
								this.sum
							);
							// console.log(this.allPrice, '888===')
						}
					})
					.catch((err) => {
						console.log('错误#', res);
					});
			},
			pharmacys() {
				let _this = this;
				pharmacy(store.state.app.serviceUid)
					.then((res) => {
						_this.adderss = res.data;
					})
					.catch((err) => {
						console.log('错误#', res);
					});
			},
			gotodrug() {
				let items = encodeURIComponent(JSON.stringify(this.drugcontent));
				uni.navigateTo({
					url: `./pharmacy?items=${items}`,
				});
			},

			//去支付确认框
			toOrderPay() {
				let _this = this;
				let orderNo = _this.orderid;

				this.$refs.notChangePop.close();

				//询问小程序是否允许发通知消息
				openOrderPaySubscribe()
					.then((res) => {
						//   let patientId = this.choosePeopleInfo.patientId
						uni.showLoading({
							title: '加载中',
						});
						this.extraction = true;
						//   创建订单接口
						let params = {
							payFlag: this.wxPay, //支付方式
							// 防疫信息
							// preventionInfo: {
							//     ...this.preventionInfo,
							// },
							preventionFlag: this.preventionFlag, //是否需要填写防疫信息   1 不需要，2需要
							deliveryType: _this.logisticsType, //快递类型
							products: _this.drugcontent,

							doctorId: store.state.app.serviceUid, //服务人员id
							storeId: store.state.app.storeId, //药店id
							isBill: _this.invoiceval.isBill,
							billType: _this.invoiceval.billType,
							rise: _this.invoiceval.rise,
							unitName: _this.invoiceval.unitName,
							taxPayerNo: _this.invoiceval.taxPayerNo,
							patientId: _this.choosePeopleInfo.patientId,
							userName: _this.provinces[0].name,
							userPhone: _this.provinces[0].phone,
							addressDistrict: _this.provinces[0].region, //省市区
							address: _this.provinces[0].address, //详细地址
							longitude: this.provinces[0].longitude,
							latitude: this.provinces[0].latitude,
						};
						// logisticsType==1 达达 
						// if (this.logisticsType != 2) {
						// params = {
						//     ...params,
						//     userName: _this.provinces[0].name,
						// userPhone: _this.provinces[0].phone,
						// addressDistrict: _this.provinces[0].region, //省市区
						// address: _this.provinces[0].address, //详细地址
						// };
						// }

						medicalOrder(params)
							.then((res) => {
								uni.hideLoading();
								// console.log(res, '创建订单res----899999');
								let orderId = `${res.data.id}`;

								//   微信支付 ：0  医保支付：1 线下不需要
								if (_this.orderValue == 0) {
									//   微信支付
									_this.getOrderWxPay(orderId);
								} else if (
									_this.orderValue == 1 ||
									_this.orderValue == '省医保' ||
									_this.orderValue == '市医保'
								) {
									console.log('----------mallorder--------------------------   ' + JSON
										.stringify(res.data));

									if (res.data.param) {
										// 医保支付 v2.0


										_this.yibaoPay2(res.data);




									} else {
										// 医保支付 v1.0
										_this.yibaoPay(orderId);
									}


								} else if (_this.orderValue == 'nonghang') {
									// n农行支付
									_this.nhPay(orderId);
								}
							})
							.catch((err) => {
								uni.showToast({
									title: err,
									icon: 'none',
									duration: 3000,
								});
								uni.hideLoading();
								this.extraction = false;
								console.log('错误#', err);
							});
					})
					.catch((err) => {
						console.log(err);
					});
			},
			// 农行支付
			nhPay(orderId) {
				// 农行
				// console.log('调用农行支付');
				let _this = this;
				let goPages = '/pagesSub-My/my/inquiryList';
				uni.showLoading({
					title: '加载中',
				});
				let params = {
					payFlag: this.wxPay, //支付方式
				};
				if (this.logisticsType == 1) {
					// 快递配送
					params = {
						...params,
						deliveryType: _this.logisticsType, //配送类型 可写死传1
						orderId: orderId,
						cityCode: _this.cityCode,
						shopNo: _this.shopNo,
						deliveryFee: _this.distributionFees, // 配送费
						longitude: this.provinces[0].longitude,
						latitude: this.provinces[0].latitude,
						spbillCreateIp: '',
						medicalType: this.wxPay, //医保类型
						// payFlag: this.wxPay, //支付方式
					};
				} else {
					// 自提
					params = {
						...params,
						deliveryType: _this.logisticsType, //配送类型 可写死传2
						deliveryFee: 0,
						orderId: orderId,
						spbillCreateIp: '',
						medicalType: this.wxPay, //医保类型
					};
				}

				// 选了优惠券
				if (this.selectId != '0') {
					params = {
						...params,
						uuid: this.selectId,
					};
				}
				// console.log(params, this.logisticsType, this.orderData, '入参99999');
				// 调用农行支付
				nonghangOrderPay(params)
					.then((res) => {
						this.bankUrl = res.data;
						let url = encodeURIComponent(JSON.stringify(res.data));

						// 保留当前页面跳转到支付页面
						uni.navigateTo({
							url: `/pagesSub/homePage/prescribing/webView?url=${url}`, //res.data,
						});

						uni.hideLoading();
					})
					.catch((err) => {
						uni.showToast({
							title: err,
							icon: 'none',
							duration: 3000,
						});
					});
			},
			//立即预约
			getOrderPay() {
				let _this = this;
				// 如果是医保预约支付弹窗提示
				if (this.wxPay == 'yuyue') {
					return this.$refs.callPop.open();
				}
				// 达达和自提配送都需要添加地址
				if (_this.provinces.length == 0) {
					this.$util.Tips({
						title: '请添加地址',
					});
					return;
				}

				if (!this.wxPay) {
					return uni.showToast({
						title: '请选择支付方式',
						icon: 'none',
						duration: 3000,
					});
				}

				this.$refs.notChangePop.open();
			},
			yibaoPay2(data) {
				let that = this;





				let params = {
					payFlag: this.wxPay, //支付方式
				};
				if (this.logisticsType == 1) {
					// 快递配送
					params = {
						...params,
						deliveryType: that.logisticsType, //配送类型 可写死传1
						orderId: data.orderId,
						cityCode: that.cityCode,
						shopNo: that.shopNo,
						deliveryFee: that.distributionFees, // 配送费
						longitude: this.provinces[0].longitude,
						latitude: this.provinces[0].latitude,
						spbillCreateIp: '',
						medicalType: this.wxPay, //医保类型
						// payFlag: this.wxPay, //支付方式
					};
				} else {
					// 自提
					params = {
						...params,
						deliveryType: that.logisticsType, //配送类型 可写死传2
						deliveryFee: 0,
						orderId: data.orderId,
						spbillCreateIp: '',
						medicalType: this.wxPay, //医保类型
					};
				}

				// 选了优惠券
				if (this.selectId != '0') {
					params = {
						...params,
						uuid: this.selectId,
					};
				}










				console.log('----------mallorder-----------------yibaoPay2---------   ' + JSON.stringify(data.param));


				/**
				 *  appId： 医保结算小程序appid，此小程序需要医院进行申请
				    extraData：结算参数
				    envVersion:打开的小程序版本 develop:开发版，trial体验版，release正式版
				*/
				var item = {

					storeSn: data.param.storeSn,

					orderInfo: data.param.detail,
					orderPay: params,



				};


				/**
				 *  appId： 医保结算小程序appid，此小程序需要医院进行申请
				    extraData：结算参数
				    envVersion:打开的小程序版本 develop:开发版，trial体验版，release正式版
				*/
				wx.navigateToMiniProgram({

					// appId: data.appId, //
					// path: 'pages/index/index',
					// extraData: {
					//     tradeno: data.tradeno, //'MPC20200403111232001',
					//     dyfid: data.dyfid,
					//     ydbh: data.ydbh,
					// },

					appId: 'wxcff29266c94592b5', // 'wxe9ad2ec23f63e83b', //医保小程序的appid
					path: 'pages/proxy',
					extraData: {
						storeSn: data.param.storeSn,

						orderInfo: data.param.detail,
						orderPay: params,
					},


					envVersion: 'develop', // develop:开发版，trial体验版，release正式版

					fail(res) {
						//  // errMsg: "navigateToMiniProgram:fail cancel"
						//关闭当前页面跳转至订单状态
						if (
							res.errMsg ==
							'navigateToMiniProgram:fail cancel'
						) {
							return _this.$util.Tips({
								title: '取消支付',
								icon: 'none',
							}, {
								tab: 5,
								url: '/pages/my/drugOrderList?status=1',
							});
						}
					},
					complete(res) {
						//关闭当前页面跳转至订单状态
						if (
							res.errMsg ==
							'navigateToMiniProgram:fail cancel'
						) {
							return _this.$util.Tips({
								title: '取消支付',
								icon: 'none',
							}, {
								tab: 5,
								url: '/pages/my/drugOrderList?status=1',
							});
						} else {
							return _this.$util.Tips({
								// title: '取消支付',
								// icon: 'none',
							}, {
								tab: 5,
								url: '/pages/my/drugOrderList?status=1',
							});
						}
					},
				});



















				// console.log('------1111----------------------------- ' + JSON.stringify(item));
				// app.globalData.threeAppData = item;
				// console.log('------222----------------------------- ' + JSON.stringify(app.globalData.threeAppData));
				// uni.navigateTo({
				// 	url: '/pagesSub-pay/proxy',
				// });







			},
			// 医保支付
			yibaoPay(orderId) {
				let _this = this;

				// 先调用下单服务,成功后返回的tradeno再调支付接口
				// 调用接口
				let params = {
					payFlag: this.wxPay
				};
				// 非东营的医保支付入参
				if (this.orderData.isDongyingStore == 1) {
					// 判断余额够不够 不够的话不让医保支付
					if (this.yibaoInfo.ye < this.orderData.actualPayment) {
						_this.extraction = false;

						return _this.$util.Tips({
							title: '医保余额不足，请更换支付方式',
							icon: 'none',
						}, {
							tab: 5,
							url: '/pages/my/drugOrderList?status=1',
						});
					}
					params = {
						...params,
						deliveryType: this.logisticsType, //快递类型
						orderId: orderId,
						deliveryFee: 0,
						spbillCreateIp: '',
						medicalType: this.yibaoInfo.sbjgbh, //医保类型
					};
				} else {
					//东营药店的医保支付入参
					params = {
						...params,
						deliveryType: this.logisticsType, //快递类型
						orderId: orderId,
						deliveryFee: 0,
						spbillCreateIp: '',
						medicalType: this.wxPay, //医保类型
					};
				}

				if (this.logisticsType == 1) {
					// 快递配送
					params = {
						...params,
						// deliveryType:this.logisticsType,//快递类型
						// orderId: orderId,
						cityCode: _this.cityCode,
						shopNo: _this.shopNo,
						deliveryFee: _this.distributionFees, // 配送费
						longitude: this.provinces[0].longitude,
						latitude: this.provinces[0].latitude,
					};
				} else {
					// 自提
					params = params;
				}
				// 选了优惠券
				if (this.selectId != '0') {
					params = {
						...params,
						uuid: this.selectId,
					};
				}
				console.log('---------------------------------    ' + JSON.stringify(params));

				yibaoOrderPay(params)
					.then((res) => {

						_this.extraction = true;
						uni.hideLoading();
						let data = res.data;
						if (res.code == 200) {
							/**
							 *  appId： 医保结算小程序appid，此小程序需要医院进行申请
							    extraData：结算参数
							    envVersion:打开的小程序版本 develop:开发版，trial体验版，release正式版
							*/
							wx.navigateToMiniProgram({

								appId: data.appId, //
								path: 'pages/index/index',
								extraData: {
									tradeno: data.tradeno, //'MPC20200403111232001',
									dyfid: data.dyfid,
									ydbh: data.ydbh,
								},




								envVersion: 'release', // develop:开发版，trial体验版，release正式版
								// success(res) {
								//     _this.extraction = true;
								//     // 打开成功
								//     // ret_handler(res);
								// },
								fail(res) {
									//  // errMsg: "navigateToMiniProgram:fail cancel"
									//关闭当前页面跳转至订单状态
									if (
										res.errMsg ==
										'navigateToMiniProgram:fail cancel'
									) {
										return _this.$util.Tips({
											title: '取消支付',
											icon: 'none',
										}, {
											tab: 5,
											url: '/pages/my/drugOrderList?status=1',
										});
									}
								},
								complete(res) {
									//关闭当前页面跳转至订单状态
									if (
										res.errMsg ==
										'navigateToMiniProgram:fail cancel'
									) {
										return _this.$util.Tips({
											title: '取消支付',
											icon: 'none',
										}, {
											tab: 5,
											url: '/pages/my/drugOrderList?status=1',
										});
									} else {
										return _this.$util.Tips({
											// title: '取消支付',
											// icon: 'none',
										}, {
											tab: 5,
											url: '/pages/my/drugOrderList?status=1',
										});
									}
								},
							});
						} else {

							return _this.$util.Tips({
								// title: '取消支付',
								// icon: 'none',
							}, {
								tab: 5,
								url: '/pages/my/drugOrderList?status=1',
							});
						}
					})
					.catch((err) => {

						console.log('-----mallorder---err------------' + err);
						_this.extraction = false;
						// 返回错误的话给出提示信息不跳转页面
						_this.$util.Tips({
								title: err,
								icon: 'none',
								duration: 3000,
							},
							// {
							//     tab: 5,
							//     url: '/pages/my/drugOrderList?status=1',
							// }
						);
					});
			},
			// 微信支付
			getOrderWxPay(orderId) {
				let _this = this;
				let goPages = '/pagesSub-My/my/inquiryList';
				uni.showLoading({
					title: '加载中',
				});
				let params = {};
				if (this.logisticsType == 1) {
					// 快递配送
					params = {
						deliveryType: _this.logisticsType, //配送类型 可写死传1
						orderId: orderId,
						cityCode: _this.cityCode,
						shopNo: _this.shopNo,
						deliveryFee: _this.distributionFees, // 配送费
						longitude: this.provinces[0].longitude,
						latitude: this.provinces[0].latitude,
						spbillCreateIp: '',
					};
				} else {
					// 自提
					params = {
						deliveryType: _this.logisticsType, //配送类型 可写死传2
						deliveryFee: 0,
						orderId: orderId,
						spbillCreateIp: '',
					};
				}

				// 选了优惠券
				if (this.selectId != '0') {
					params = {
						...params,
						uuid: this.selectId,
					};
				}
				// console.log(params, this.logisticsType, this.orderData, '入参99999');
				// return
				//   预订单接口
				wechatOrderPay(params)
					.then((res) => {
						let jsConfig = res.data;
						uni.requestPayment({
							timeStamp: jsConfig.timeStamp,
							nonceStr: jsConfig.nonceStr,
							package: jsConfig.packageValue,
							signType: jsConfig.signType,
							paySign: jsConfig.paySign,
							// ticket: _this.productType==='normal'? null : jsConfig.ticket,
							success: function(ress) {
								uni.hideLoading();
								// 调用接口查询通知接口支付成功，接口修改其订单状态
								// orderData.orderNumber  || orderData.orderId
								_this.extraction = false;
								return _this.$util.Tips({
									title: '支付成功',
									icon: 'success',
								}, {
									tab: 5,
									url: '/pages/my/drugOrderList?status=2',
								});
							},
							fail: function(e) {
								uni.hideLoading();
								return _this.$util.Tips({
									title: '取消支付',
									icon: 'none',
								}, {
									tab: 5,
									url: '/pages/my/drugOrderList?status=1',
								});
							},
							complete: function(e) {
								uni.hideLoading();
								//关闭当前页面跳转至订单状态
								if (e.errMsg == 'requestPayment:cancel') {
									// console.log('支付结果---', e, orderId)
									return _this.$util.Tips({
										title: '取消支付',
										icon: 'none',
									}, {
										tab: 5,
										url: '/pages/my/drugOrderList?status=1',
									});
								}
							},
						});
					})
					.catch((err) => {
						_this.extraction = false;
						uni.hideLoading();
						return _this.$util.Tips({
							title: err,
						}, {
							tab: 5,
							url: '/pages/my/drugOrderList?status=1',
						});
					});
			},
		},
	};
</script>

<style lang="scss" scoped>
	@import '@/static/css/style.css';

	// 物流弹窗
	.dialogDiangnosis {
		padding: 30rpx;
		width: 250px;
		/* height: 385px; */
		background-color: #ffffff;
		border-radius: 20rpx;
	}

	.durgName {
		font-size: 30rpx;
		margin-top: 8rpx;
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		word-break: break-all;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	/deep/.uni-easyinput__content-input.data-v-abe12412 {
		font-size: 30rpx;
		text-align: right;
	}

	// /deep/.segmented-control__text.data-v-064e9cd1 {
	//     color:#4cccbf !important
	// }
	// /deep/.segmented-control__item--button.data-v-064e9cd1 {
	//     background-color: pink;
	// }
	.invoiceInput {
		margin-top: 30rpx;
	}

	.tag {
		color: #ffffff !important;
		background-color: #4cccbf !important;
	}

	.bg_image {
		background-image: url(../../../pagesSub/static/images/bg_menzhen@2x.png);
		height: 200rpx;
		background-size: 100% 100%;
		color: #ffffff;
		padding: 30rpx;
	}

	.invoice {
		display: flex;
		margin: 10rpx 0;
	}

	.appointment {
		font-weight: 600;
	}

	.peopinfoContent {
		padding-bottom: 20rpx;
		border-bottom: 1rpx solid #fbfbfb;
	}

	.peopinfo {
		font-size: 32rpx;
	}

	.prompt_font {
		font-size: 29rpx;
		margin-top: 5rpx;
	}

	.card_content {
		background-color: #ffffff;
		padding: 30rpx;
		margin: 30rpx;
		border-radius: 10rpx;
	}

	.card_one {
		// margin-top: -208rpx;
	}

	.phone {
		margin-left: 30rpx;
	}

	.addressinfo {
		color: #3f3f3f;
		font-size: 30rpx;
		margin-top: 5rpx;
	}

	.personal_info {
		display: flex;
		justify-content: space-between;
	}

	.medical_content {
		display: flex;
		margin-top: 30rpx;
		border-bottom: 1rpx solid #fbfbfb;
		padding-bottom: 30rpx;
	}

	.medical_img {
		width: 170rpx;
		height: 120rpx;
	}

	.medical_img image {
		width: 100%;
		height: 100%;
	}

	.medical_right {
		margin-left: 30rpx;
		width: 100%;
	}

	.medical_title {
		display: flex;
		justify-content: space-between;
	}

	.pa_top {
		margin-top: 20rpx;
	}

	.medical_price {
		float: right;
		color: #d57667;
		font-weight: 600;
		font-size: 33rpx;
	}

	.real_payment {
		color: #d57667;
	}

	.btns {
		width: 100%;
		display: flex;
		justify-content: space-between;
		margin-top: 70rpx;
	}

	.bth_green {
		border-top-right-radius: 40rpx;
		border-bottom-right-radius: 40rpx;
		border-top-left-radius: 40rpx;
		border-bottom-left-radius: 40rpx;
		border: 1rpx solid #4cccbf;
		background-color: #ffffff;
		color: #4cccbf;
		height: 50rpx;
		line-height: 50rpx;
		font-size: 24rpx;
		padding: 0 25rpx;
	}

	.add_medical {
		display: flex;
		color: #4cccbf;
		text-align: center;
		font-size: 30rpx;
		margin-top: 40rpx;
		margin-left: 40%;
	}

	.iphoneBottom {
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
		box-sizing: content-box;
	}

	.btn_appointment {
		/*margin-bottom: 40rpx;*/
		background: -webkit-linear-gradient(#77e2a4, #4ccdbc);
		color: #ffffff;
	}

	.btn_invoice {
		color: #ffffff;
		background-color: #4ccdbc;
		font-size: 30rpx;
		margin-top: 60rpx;
		margin-bottom: 30rpx;
	}

	.personalfont {
		font-size: 32rpx;
	}

	.green_font {
		color: #4cccbf;
	}

	.addressName {
		font-size: 30rpx;
		margin-top: 20rpx;
	}

	.medicalName {
		font-size: 31rpx;
	}

	.specification {
		font-size: 30rpx;
		margin-top: 20rpx;
	}

	.icon_greenadd {
		width: 35rpx;
		height: 35rpx;
	}

	.customerService {
		width: 100%;
		height: 200rpx;
		margin-bottom: 150rpx;
	}

	.customerService image {
		width: 120rpx;
		height: 120rpx;
		float: right;
		margin-right: 30rpx;
		margin-top: 20rpx;
	}

	.colse_content::after {
		display: block;
		clear: both;
		content: '';
	}

	/* 支付按钮 */
	.payment_button {
		width: 100%;
		display: flex;
		position: fixed;
		bottom: 0;
		height: 80rpx;
		background-color: #ffffff;
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
		box-sizing: content-box;
	}

	.payment_button::after {
		content: '';
		display: block;
		clear: both;
	}

	.combined {
		font-size: 30rpx;
		text-align: center;
		line-height: 80rpx;
		width: 40%;
		background-color: #ffffff;
	}

	.combined_money {
		font-weight: bold;
		color: #5cc8b3;
	}

	.immediate {
		background: -webkit-linear-gradient(#77e2a4, #4ccdbc);
		color: #ffffff;
		line-height: 80rpx;
		font-size: 35rpx;
		width: 60%;
		text-align: center;
	}

	/* 弹出框 */
	.inputDialog {
		width: 600rpx;
		border-radius: 10rpx;
		background-color: #ffffff;
	}

	.inputDialog>.title {
		text-align: center;
		padding: 30rpx;
		font-size: 32rpx;
		line-height: 50rpx;
	}

	.button-bottom {
		display: flex;
		border-top: 1px solid #f0f0f0;
	}

	.button-bottom view {
		width: 50%;
		padding: 20rpx 0 20rpx 0;
		font-size: 32rpx;
		text-align: center;
	}

	.cancel {
		border-right: 1px solid #f0f0f0;
	}

	/* 绿色字体 */
	.green_words {
		color: #62c0ad;
	}

	.servicecard {
		padding: 0 30rpx 6rpx;
		margin: 20rpx 30rpx;
		background-color: #ffffff;
		border-radius: 10rpx;
	}

	.activeList {
		padding-bottom: 20rpx;
	}

	.couponCard {
		padding: 15rpx 30rpx;
		margin: 20rpx 30rpx;
		border-radius: 20rpx;
		background: linear-gradient(to right, #70c6fc, #fd4afd);
		// height: 200rpx;
	}

	.couponType {
		background: #4ccdbc;
		color: #ffffff;
		font-size: 12px;
		padding: 0 10rpx;
		border-radius: 10rpx;
		position: relative;
		top: -24rpx;
		left: -24rpx;
	}

	.disFlex {
		display: flex;
	}

	.danwei {
		color: red; // #4ccdbc;
		font-size: 54rpx;
	}

	.money {
		color: red; // #4ccdbc;
		font-size: 50rpx;
		display: inline-block;
		border-right: 1px dashed #cccccc;
		padding-right: 20rpx;
	}

	.manjian {
		font-size: 38rpx;
		color: red; // #4ccdbc;
		margin-left: 20rpx;
		margin-top: 20rpx;
	}

	.haveCount {
		margin: 10rpx auto 0;
		font-size: 12px;
		color: #ffffff; // #9c9b9b;
	}

	.zhushi {
		color: red; // #9c9b9b;
	}



	.btn_small {
		font-size: 27rpx;
		color: #ffffff;
		padding: 2rpx 15rpx;
		text-align: center;
		border-radius: 40rpx;
		background: -webkit-linear-gradient(#77e2a4, #4ccdbc);
		height: 50rpx;
		line-height: 50rpx;
	}

	.openPopImg {
		margin: 40rpx auto 0;
	}
</style>